<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }
.container{
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh; /* 添加这行，让容器占满视口高度 */
  width: 100vw;  /* 可选：让容器占满视口宽度 */
}
    .box{  

      width: 500px;
      height: 20px;
      background-color: red;
      transition: transform .5s ease;
       
    }
   .box:hover{
     transform: scaleX(2);
     /* 改变变换原点，默认为center */
     transform-origin: left;
    }
  </style>
</head>
<body>
 <div class="container">
   <div class="box"></div>
 </div>
</body>
</html>